<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>onload和onunload事件</title>
</head>

<body onload="checkCookies()">
    <p>弹窗-提示浏览器 cookie 是否可用。</p>
    <script>
        function checkCookies() {
            if (navigator.cookieEnabled == true) {
                alert("Cookies 可用")
            }
            else {
                alert("Cookies 不可用")
            }
        }
    </script>
</body>

</html>